package org.moonlight.jvm.instructions.extended;

import org.moonlight.jvm.instructions.base.BranchInstruction;
import org.moonlight.jvm.rtda.exclusive.Frame;

/**
 * IFNULL: 把 操作数栈栈顶 的引用弹出, 判断引用是否为null决定是否跳转
 *
 * @author Moonlight
 * @createTime 2023/8/23 10:25
 **/
public class IfNull extends BranchInstruction {

    @Override
    public void execute(Frame frame) {
        Object ref = frame.getOperandStack().popRef();
        if (ref == null) {
            branch(frame);
        }
    }

}
